//
//  UIView+ZJFrame.m
//  Lottery
//
//  Created by ZJ on 2018/8/15.
//  Copyright © 2018年 iCatch Technology Inc. All rights reserved.
//

#import "UIView+ZJFrame.h"

@implementation UIView (ZJFrame)

- (void)setX:(CGFloat)x {
    // 获取 view 的 frame
    CGRect rect = self.frame;
    // 修改结构体
    rect.origin.x = x;
    // 赋值
    self.frame = rect;
}

- (CGFloat)x {
    return self.frame.origin.x;
}

- (void)setY:(CGFloat)y {
    CGRect rect = self.frame;
    rect.origin.y = y;
    self.frame = rect;
}

- (CGFloat)y {
    return self.frame.origin.y;
}

- (void)setWidth:(CGFloat)width {
    CGRect rect = self.frame;
    rect.size.width = width;
    self.frame = rect;
}

- (CGFloat)width {
    return CGRectGetWidth(self.frame);
}

- (void)setHeight:(CGFloat)height {
    CGRect rect = self.frame;
    rect.size.height = height;
    self.frame = rect;
}

- (CGFloat)height {
    return CGRectGetHeight(self.frame);
}

@end
